package factory.functionFactory

/**
 * 定义一辆奥迪车
 */
class AudiCar(override var color: String = "红色", override var brand: String = "奥迪") : Car {

    /**
     * 设置属性
     */
    override fun setColor(color: String): Car {
        return apply {
            this.color = color
        }
    }

    override fun setBrand(brand: String): Car {
        return apply {
            this.brand = brand
        }
    }

    /**
     * 使用apply函数实现建造者模式
     */


    override fun run() {
        PrintUtil.print("一辆${color}的${brand}在跑")
    }
}